﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DynaPrecision
{
	using DynaPrecision.Financial;
	public static class EMTransformedFiniteDifferenceScheme
	{
		public static void ShiftToCurrentPrice(this TransformedFiniteDifferenceScheme scheme)
		{
			if (scheme.BaseLinePrice != 0)
			{
				double x0 = Math.Log(scheme.CurrentPrice / scheme.BaseLinePrice);
				double dl = scheme.TransformedPriceUpperBound - scheme.TransformedPriceLowerBound;
				scheme.TransformedPriceLowerBound = x0 - 0.5 * dl;
				scheme.TransformedPriceUpperBound = x0 + 0.5 * dl;
			}
		}
	}
}
